// 使用常量来存储 key
const GEEK_TOKEN_KEY = "geek-h5-token"

export const getToken = () => JSON.parse(localStorage.getItem(GEEK_TOKEN_KEY))
//  设置 token
export const setToken = (token) =>
  localStorage.setItem(GEEK_TOKEN_KEY, JSON.stringify(token))

//  清除 token
export const clearToken = () => localStorage.removeItem(GEEK_TOKEN_KEY)

export const isAuth = () => !!getToken()
